package com.ls.kdlss.ui.Login;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.gm.common.utils.ActivityUtil;
import com.gm.lib.views.titlebar.AbTitleBar;
import com.ls.kdlss.R;
import com.ls.kdlss.util.IsPhoneAndNull;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/10/26.
 */

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {


    @Bind(R.id.title_bar)
    AbTitleBar titleBar;
    @Bind(R.id.iv_next)
    ImageView ivNext;
    @Bind(R.id.tv_registext)
    TextView tvRegistext;
    @Bind(R.id.et_phone_num)
    EditText phoneNum;
    private String type;
    public static void launch(Context context ,String type) {
        Bundle bundle=new Bundle();
        bundle.putString("type",type);
        ActivityUtil.startActivity(context, RegisterActivity.class ,bundle);
    }




    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ButterKnife.bind(this);
        Bundle bundle= getIntent().getExtras();
        type=bundle.getString("type");
        if (type.equals("1")){
            tvRegistext.setText("输入手机号重新设置密码");
            titleBar.setTitleText("忘记密码");
        }else {
            tvRegistext.setText("请输入手机号");
            titleBar.setTitleText("注册");
        }
        titleBar.setLeftVisible();

    }

    @OnClick({R.id.title_bar, R.id.iv_next})
    @Override
    public void onClick(View v) {

        switch (v.getId()) {
            case R.id.iv_next:
                if (!IsPhoneAndNull.isPhoneAndCod(RegisterActivity.this, phoneNum.getText().toString(), IsPhoneAndNull.PHONE)) {
                    return;
                }else{
                    VerjfjcatjnActivity.launch(RegisterActivity.this,type);
                }

                break;
        }

    }


}
